package service

import (
	"fmt"
	"go-web-demo/biz/user/domain/dao"
	"go-web-demo/biz/user/domain/req"
)

type UserService interface {
	Registry(u req.UserRequest)
	FindUser(userId string) *dao.UserInfo
}

type UserServiceImpl struct {
}

func (user UserServiceImpl) Registry(u req.UserRequest) {
	var (
		userInfo = &dao.UserInfo{
			Id:       0,
			Account:  u.Account,
			Password: u.Password,
		}
	)
	// todo check user exists, if exist return false
	userInfo.Insert()
	// todo insert into user table
}

func (user UserServiceImpl) FindUser(userId string) *dao.UserInfo {
	fmt.Println(userId)
	userInfo := &dao.UserInfo{}
	userInfo.SelectUserByAccount(userId)
	return userInfo
}
